package com.aaa.medicine.controller;

import com.aaa.entity.PurchaseItem;
import com.aaa.medicine.service.ExamineService;
import com.aaa.medicine.service.NewPurchaseService;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("medicine/new")
public class NewPurchaseController {

    @Resource
    private NewPurchaseService newPurchaseService;

//雪花
    @GetMapping("xuehua")
    private Result xuehua(){

        return new Result(newPurchaseService.gett());
    }
    @Autowired
    private ExamineService examineService;
    @PostMapping("getAll")
    public Result getAll(){
        List<PurchaseItem> list = examineService.list();
        return new Result(list);
    }
    //暂存
    @PostMapping("addnew")
    public Result<String> addNew(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return newPurchaseService.newadd(map);

    }
    //添加
    @PostMapping("addnew1")
    public Result<String> addNew1(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return newPurchaseService.newadd1(map);

    }
}
